Skip to content

fix: remove stage dependent mandatory fields for plans datasets - #576

Merged
tombrooks248 merged 1 commit into
mainfrom
fix/plan-fields-not-mandatory
Jul 13, 2026
Merged

fix: remove stage dependent mandatory fields for plans datasets#576
tombrooks248 merged 1 commit into
mainfrom
fix/plan-fields-not-mandatory

Conversation

@tombrooks248

@tombrooks248 tombrooks248 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Remove period-end-date and document-url (all four plan datasets) and required-housing (local-plan only) from MANDATORY_FIELDS_DICT in harmonise.py, so blanks no longer raise missing value issues.

Why

These fields are stage-dependent: an LPA only holds this data once it has reached proposed-plan-consultation-start in its plan-timetable. The current binary check fires for every LPA that hasn't reached that stage, producing false-positive tasks on the LPA Dashboard (and in the check tool).

This is just phase 1

This PR only removes the false positives. Restoring the correct signal — flag only once proposed-plan-consultation-start has an actual-date in the past — we be a separeate PR (probably 3 PRs across different repos) as a post-build expectation Still as part of this ticket. My plan is to have no check on these fields for a period of time probably a few days. But we can delay this PR until phase 2 is ready if we think have false positives is better than having no positives?

Added a regression test asserting these fields are not flagged when blank.

Related Tickets & Documents

QA Instructions, Screenshots, Recordings

Please replace this line with instructions on how to test your changes, a note
on the devices and browsers this has been tested on, as well as any relevant
images for UI changes.

Added/updated tests?

We encourage you to keep the code coverage percentage at 80% and above. Please refer to the Digital Land Testing Guidance for more information.

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

[optional] Are there any post deployment tasks we need to perform?

[optional] Are there any dependencies on other PRs or Work?

Summary by CodeRabbit

  • Bug Fixes
    • Updated mandatory-field validation for local, supplementary, minerals and waste plans.
    • Planning authority and documentation URL details are now required where appropriate.
    • Certain stage-dependent fields are no longer incorrectly flagged as missing.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Updated mandatory-field definitions for four plan datasets and added a unit test confirming that selected blank local-plan fields are not reported as missing during harmonisation.

Changes

Plan mandatory fields

Layer / File(s) Summary
Mandatory field contract and validation
digital_land/phase/harmonise.py, tests/unit/phase/test_harmonise.py
Mandatory fields were updated for local, supplementary, minerals, and waste plans; a test verifies that blank stage-dependent local-plan fields are not flagged as missing.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: removing stage-dependent mandatory fields from plans datasets.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/plan-fields-not-mandatory

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tombrooks248
tombrooks248 marked this pull request as ready for review July 13, 2026 10:07

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tests/unit/phase/test_harmonise.py (1)

160-207: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the other three plan datasets as well.

This regression test only exercises local-plan, while the mandatory-field contract was changed for all four plan datasets. Parameterise the test, or add equivalent cases for supplementary, minerals, and waste plans, so an incorrect field removal in those datasets cannot pass unnoticed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/phase/test_harmonise.py` around lines 160 - 207, Extend
test_harmonise_stage_dependent_plan_fields_not_flagged to cover supplementary,
minerals, and waste plan datasets in addition to local-plan, using
parameterisation or equivalent cases. Ensure each dataset verifies that
period-end-date, document-url, and required-housing remain unflagged when blank.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/unit/phase/test_harmonise.py`:
- Around line 160-207: Extend
test_harmonise_stage_dependent_plan_fields_not_flagged to cover supplementary,
minerals, and waste plan datasets in addition to local-plan, using
parameterisation or equivalent cases. Ensure each dataset verifies that
period-end-date, document-url, and required-housing remain unflagged when blank.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1c170d60-8135-4927-a937-03d67a7b1142

📥 Commits

Reviewing files that changed from the base of the PR and between 992bfe8 and d83c6d9.

📒 Files selected for processing (2)
  • digital_land/phase/harmonise.py
  • tests/unit/phase/test_harmonise.py
💤 Files with no reviewable changes (1)
  • digital_land/phase/harmonise.py

@tombrooks248
tombrooks248 merged commit fa6580a into main Jul 13, 2026
6 checks passed
@tombrooks248
tombrooks248 deleted the fix/plan-fields-not-mandatory branch July 13, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants